<template>
  <el-form-item label="车辆品牌">
    <el-select v-model="value" placeholder="请选择" @change="Brandchange" clearable>
      <el-option
        v-for="item in options"
        :key="item.carBrandCode"
        :label="item.carBrandCn"
        :value="item.carBrandCode"
      ></el-option>
    </el-select>
  </el-form-item>
</template>

<script>
import { requestAPI } from "@/api/commonRequest";
import { crmApis } from "@/api/apiList/crm";
export default {
  name: "vehicle",
  // props: {
  //   vehicle: {
  //     value: String
  //   }
  // },
  data() {
    return {
      options: this.getData(),
      value:''
    };
  },
  mounted: function() {
    //
  },
  methods: {
    getData: function() {
      let that = this;
      let queryObj = {
        // api配置
        apiConfig: crmApis.mdmCarBrandQueryByPage,
        // 需要调用的API服务配置
        apiServices: [
          {
            //表格中台返回网格的字段
            apiQueryRow: ["carBrandCode", "carBrandCn"]
          }
        ],
        //条件/实体参数（变量），根据typeParam中的定义配置
        variables: {
          pageSize: 10,
          pageIndex: 1,
          //当前中台使用的名称有dataInfo、info，具体查看API文档
          dataInfo: {
            oemCode: 1,
            groupCode: 1,
            // functionCode: that.$refs.imageTypeMainRef.value,
          } //值列表编码
        }
      };
      let paramD = that.$getParams(queryObj);
      // 调用中台API方法（可复用）
      requestAPI(paramD).then(response => {
        if (
          response.result == "1"
        ) {
          that.options = response.rows;
        }
      });
    },
    reset: function() {
      let that = this;
      this.value = "";
    },
    Brandchange(val){
      this.$emit('changeBrand',val)
    }
  }
};
</script>
<style scoped>
</style>
